<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
		"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:a4j="http://richfaces.org/a4j"
      xmlns:rich="http://richfaces.org/rich">

<ui:composition template="/templates/template.xhtml">

	<ui:define name="body">
		<h:form>

			<a4j:poll reRender="dashboardTable" interval="5000" immediate="true" ignoreDupResponses="true"
			          enabled="true"/>

			<rich:panel styleClass="centeredPanel">
				<f:facet name="header">
					<h:outputText value="#{msg.PANEL_HEADER_LAST_ACTIVITIES}"/>
				</f:facet>

				<rich:dataTable id="dashboardTable" rowKeyVar="rowNumber" var="buildDefinition"
				                styleClass="dashboardTable"
				                value="#{dashboardBean.allBuildsDefinitions}">
					<rich:column>
						<f:facet name="header">
							<h:outputText value="#{msg.COLUMN_ROW_NO}"/>
						</f:facet>
						<h:outputText value="#{rowNumber+1}"/>
					</rich:column>

					<rich:column>
						<f:facet name="header">
							<h:outputText value="#{msg.PLAN_NAME}"/>
						</f:facet>
						<h:commandLink value="#{buildDefinition.name}"
						               action="#{dashboardBean.showBuildDefinitionDetails}"/>
					</rich:column>

					<rich:column>
						<f:facet name="header">
							<h:outputText value="#{msg.ACTIVITY}"/>
						</f:facet>
						<h:commandLink value="#{buildDefinition.name}-#{buildDefinition.lastActivity.buildNumber}"
						               action="#{dashboardBean.showLastBuildActivityDetails}"/>
					</rich:column>

					<rich:column>
						<f:facet name="header">
							<h:outputText value="#{msg.START_TIME}"/>
						</f:facet>
						<h:outputText value="#{buildDefinition.lastActivity.startedInterval} #{msg.AGO}"/>
					</rich:column>

					<rich:column>
						<f:facet name="header">
							<h:outputText value="#{msg.END_TIME}"/>
						</f:facet>
						<h:outputText value="#{buildDefinition.lastActivity.endedInterval} #{msg.AGO}"/>
					</rich:column>

					<rich:column>
						<f:facet name="header">
							<h:outputText value="#{msg.DURATION}"/>
						</f:facet>
						<h:outputText value="#{buildDefinition.lastActivity.duration}"/>
					</rich:column>

					<rich:column>
						<f:facet name="header">
							<h:outputText value="#{msg.STATUS}"/>
						</f:facet>
						<h:outputText value="#{buildDefinition.lastActivity.result}"
						              styleClass="column-#{buildDefinition.lastActivity.result}"
						              rendered="#{buildDefinition.lastActivity.result.finished}"/>
						<h:graphicImage rendered="#{not buildDefinition.lastActivity.result.finished}"
						                title="#{buildDefinition.lastActivity.result}"
						                alt="#{buildDefinition.lastActivity.result}"
						                value="../img/job-in-progress.gif"/>
					</rich:column>

					<rich:column>
						<a4j:commandLink action="#{dashboardBean.fireBuild}" reRender="dashboardTable">
							<h:graphicImage title="#{msg.BUTTON_FIRE_BUILD}" alt="#{msg.BUTTON_FIRE_BUILD}"
							                value="../img/play.gif"/>
						</a4j:commandLink>
					</rich:column>

					<rich:column>
						<h:outputLink value="../rss?buildDef=#{buildDefinition.name}">
							<h:graphicImage title="#{msg.BUTTON_RSS}" alt="#{msg.BUTTON_RSS}" value="../img/feed.png"/>
						</h:outputLink>
					</rich:column>
				</rich:dataTable>
			</rich:panel>
		</h:form>
	</ui:define>
</ui:composition>
</html>